﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace windows.实验一
{
    class Class6
    {
        static void Main(string[] args)
        {
            #region 打印杨辉三角形（10行）
            int[,] array = new int[10, 10];
            for (int i = 0; i < 10; i++)
            { 
                for (int k = 0; k < 10 - i; k++) 
                {
                    Console.Write(" ");
                }
                for (int j = 0; j <= i; j++) 
                {
                    if (j == 0 || i == j)  
                    {
                        array[i, j] = 1; 
                    }
                    else
                    {
                        array[i, j] = array[i - 1, j - 1] + array[i - 1, j]; 
                    }
                    Console.Write(array[i, j].ToString() + " "); 
                }
                Console.WriteLine();
            }
            Console.ReadKey();
            #endregion
        }
    }
}
